'use strict';

import './detail.less';
import detailTpl from './detail.tpl.html';
import AppsInfo from '../utils/apps-info';
import Loading from '../components/loading';

export default {
    init(page){
    	console.log(page);
    	console.log(this);
    	console.log(window.appIndex);
        console.log('id: ' + page.query.id);
        Loading.show();
        this.initCtx();
    },
    initCtx(){
    	var self = this;
    	$('.title-value').html(window.currentApp.name);
    	var iframe = document.getElementsByTagName('iframe')[0];
		iframe.onload = self.initSuccess();
    	$('.iframe-ctx').attr('src','http://127.0.0.1:8333');
    },
    initSuccess(){
    	setTimeout(function() {
	    	console.log("load success");
	        Loading.hide();
	    	var iframe = document.getElementsByTagName('iframe')[0];
	        iframe.style.display = "block";  
    	}, 1500);
    }
};